# -*- coding: utf-8 -*-
import xlrd
from com.whenjun.koukou.exif import exifgps
# reload(sys)
# sys.setdefaultencoding('utf-8')
def bianli():
    data = xlrd.open_workbook('D:\\excel\\zong.xls')
    table = data.sheet_by_index(0)
    
    nrows = table.nrows
    ncols = table.ncols
    
    for row  in range(1, nrows):
    #     name = table.cell(row, 1).value
    #     print '尊敬的' + name + ':\n    感谢您为公司做出的辛苦努力，以下是您9月份的工资信息，如有疑问请与人资联系。'
    #     print '-------' + name + '--------'
        #     图片地址
        url = ""
        
        #    经度
        lng = ""
        
        #    纬度
        lat = ""
        
        for col in range(ncols):
    #         print(table.cell(row, col).value)
            if(col == 2):
                url = table.cell(row, col).value
                url = url.replace("https://headimg.ifootbook.com/", "").replace("http://footbackdata.ifootbook.com/","").replace(".png",".jpg").replace("/","_")
            
            if(col == 3):
                lng = table.cell(row, col).value
                
            if(col == 4):
                lat = table.cell(row, col).value
    #         cell = table.cell(row, col).value
    #         h1 = table.cell(0, col).value
    #         h2 = table.cell(1, col).value
    #         ctype = table.cell(row, col).ctype
    #         if ctype == 1:
    #             print h1 + h2 + ":" + cell
    #         elif ctype == 3:
    #             d = datetime(*xlrd.xldate_as_tuple(cell, 0))
    #             print h1 + h2 + ":" + d.strftime("%Y-%m-%d")
    #         else:
    #             print h1 + h2 + ":" + str(cell)
        print(url)
        exifgps.wGps(lng, lat, url)
        print '-------end--------'
        
def doString(name):
    return "D:/java_down/" + name
    
    
if __name__ == '__main__':
    bianli()